//
// Created by denglibin on 2020/7/1.
// leetocde 53. 最大子序和          f(i) = max(f(i-1)+ai, ai);  res = max(f(i))

static int max(int x, int y){
    return x > y ? x : y;
}
static int maxSubArray(int* nums, int numsSize){

    int pre = 0, res = nums[0];
    for(int i = 0; i < numsSize; i++){
        pre = max(pre + nums[i], nums[i]);
        res = max(pre, res);
    }
    return res;
}

